#@head() 
#@header()
<title>客户列表</title>
#@aside("user")
<script type="text/javascript" src="#(path)/assets/js/jquery.tmpl.min.js"></script>
<style>
	.box-body{padding:5px !important}
</style>
<div class="content-wrapper">
	<section class="content">
	<div class="nav-tabs-custom">
		#@usermenu("jbxx")
		<div class="tab-content">
		  <div class="tab-pane active" id="tab_1">  
			<div class="box-body">
			<table id="example1" class="table table-bordered table-striped dataTable col-md-8" role="grid" aria-describedby="example1_info">
				<tbody>
				<tr role="row" class="odd">
				  <td align="right" style="width:130px;" class="sorting_1">用户ID：</td>
				  <td id="id" class="sorting_1"></td>
				</tr>
				<tr role="row" class="even">
				  <td align="right" style="width:130px;" class="sorting_1">手机号码：</td>
				  <td id="mobile" class="sorting_1"></td>
				</tr>
				<tr role="row" class="odd">
				  <td align="right" style="width:130px;" class="sorting_1">真实姓名：</td>
				  <td id="real_name" class="sorting_1"></td>
				</tr>
				<tr role="row" class="even">
				  <td align="right" style="width:130px;" class="sorting_1">资金账户：</td>
				  <td id="code" class="sorting_1"></td>
				</tr>
				<tr role="row" class="even">
				  <td align="right" style="width:130px;" class="sorting_1">账户余额：</td>
				  <td class="sorting_1"><span id="amount"></span> 元(可用余额：<span id="availableAmount"></span> 元 冻结金额：<span id="dongjie"></span> 元)</td>
				</tr>
				<tr role="row" class="odd">
				  <td align="right" style="width:130px;" class="sorting_1">邮箱绑定：</td>
				  <td id="email" class="sorting_1"></td>
				</tr>
				<tr role="row" class="odd">
				  <td align="right" style="width:130px;" class="sorting_1">加入天数：</td>
				  <td id="days" class="sorting_1"></td>
				</tr>
				<tr role="row" class="odd">
				  <td align="right" style="width:130px;" class="sorting_1">注册时间：</td>
				  <td id="create_time" class="sorting_1"></td>
				</tr>
				<tr role="row" class="odd">
				  <td align="right" style="width:130px;" class="sorting_1">实名时间：</td>
				  <td id="real_name_time" class="sorting_1"></td>
				</tr>
				<tr role="row" class="even">
				  <td align="right" style="width:130px;" class="sorting_1">开户时间：</td>
				  <td id="bind_card_time" class="sorting_1"></td>
				</tr>
				<tr role="row" class="even">
				  <td align="right" style="width:130px;" class="sorting_1">经纪人：</td>
				  <td id="agent" class="sorting_1"></td>
				</tr>
				<tr role="row" class="odd">
				  <td align="right" style="width:130px;" class="sorting_1">推荐人：</td>
				  <td id="referee" class="sorting_1"></td>
				</tr>
				<tr role="row" class="odd">
				  <td align="right" style="width:130px;" class="sorting_1">推广渠道：</td>
				  <td id="pop_channel" class="sorting_1"></td>
				</tr>
				<tr role="row" class="odd">
				  <td align="right" style="width:130px;" class="sorting_1">下载渠道：</td>
				  <td id="download_channel" class="sorting_1"></td>
				</tr>
				<tr role="row" class="odd">
				  <td align="right" style="width:130px;" class="sorting_1">登录端口：</td>
				  <td id="login_type" class="sorting_1"></td>
				</tr>
				<tr role="row" class="odd">
				  <td align="right" style="width:130px;" class="sorting_1">状态：</td>
				  <td id="status" class="sorting_1">正常</td>
				</tr>
				</tbody>
			</table>
			</div>
		</div>
	</div>
	</section>
</div>
#@footer()
<script>
$(document).ready(function(){
	$.getJSON("/user/fullInfo?token=#(session.token??)&id="+id.id, function(userinfo) {
		console.log(userinfo);
		setFormVals(userinfo.data.info);
		var item = userinfo.data.info;
		$("#sex").html(userinfo.data.info.sex==1 ? "男" : "女");
		if(item.status=="normal"){$("#status").html("正常")}
			else if(item.status=="disable"){$("#status").html("禁用")}
			else if(item.status=="freeze"){$("#status").html("冻结")}
		if(item.download_channel=="default"){$("#download_channel").html("官方平台")}
			else if(item.download_channel=="mumayi"){$("#download_channel").html("木蚂蚁")}
			else if(item.download_channel=="xiaomi"){$("#download_channel").html("小米")}
			else if(item.download_channel=="anzhi"){$("#download_channel").html("安智")}
		if(!$.isBlank(item.url)){ 
			$("#link").attr("href",item.url); 
			$("#link").html("（查看）"); 
		}
		if(item.referee ==0){
			$("#referee").html(""); 
		}
		var dongjie = userinfo.data.info.amount - userinfo.data.info.availableAmount;
		$("#dongjie").html(dongjie);
		var now = getNowFormatDate().substring(0,10); 
		var days = DateDiff((item.create_time).substring(0,10),now)+1;
		
		$("#days").html(days+" 天");
	}); 
	//菜单
});

function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
            + " " + date.getHours() + seperator2 + date.getMinutes()
            + seperator2 + date.getSeconds();
    return currentdate;
}
function  DateDiff(sDate1, sDate2){    //sDate1和sDate2是2006-12-18格式  
    var  aDate,  oDate1,  oDate2,  iDays  
    aDate  =  sDate1.split("-")  
    oDate1  =  new  Date(aDate[1]  +  '-'  +  aDate[2]  +  '-'  +  aDate[0])    //转换为12-18-2006格式  
    aDate  =  sDate2.split("-")  
    oDate2  =  new  Date(aDate[1]  +  '-'  +  aDate[2]  +  '-'  +  aDate[0])  
    iDays  =  parseInt(Math.abs(oDate1  -  oDate2)  /  1000  /  60  /  60  /24)    //把相差的毫秒数转换为天数  
    return  iDays  
}    
</script>
</body>
</html>